package com.mlk.engUser.api;

import com.mlk.core.util.ServerResponse;
import com.mlk.engUser.po.EngUserBankCard;
import com.mlk.engUser.service.EngUserBackCardService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/bankcard")
public class EngUserBankCardAPI {

    @Resource
    private EngUserBackCardService engUserBackCardService;

    /**
     * 添加银行卡
     * @return
     */
    @PostMapping("add")
    public ServerResponse addCard(EngUserBankCard card){
        return this.engUserBackCardService.add(card);
    }

    /**
     * 查询用户所绑定的银行卡
     * @return
     */
    @GetMapping("userCards")
    public ServerResponse userCards(String openId){
        return this.engUserBackCardService.userCards(openId);
    }

    /**
     * 修改用户的银行卡信息
     * @return
     */
    @PostMapping("editCard")
    public ServerResponse editCard(EngUserBankCard card){
        return this.engUserBackCardService.editCard(card);
    }


    /**
     * 删除银行卡
     * @param id
     * @return
     */
    @GetMapping("del")
    public ServerResponse del(Integer id){
        return this.engUserBackCardService.del(id);
    }
}
